package com.haohope.framework.wb.buffer;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import com.haohope.framework.cache.RedisCache;
import com.haohope.framework.redis.FastJsonRedisTemplate;
import com.wb.tool.DictRecord;

public class ReidsDictionaryBuffer extends DictionaryBuffer{
	private RedisCache buffer;
	public ReidsDictionaryBuffer(FastJsonRedisTemplate redisTemplate) {
		buffer = new RedisCache(redisTemplate,"wb:dictionary");
	}
	@Override
	public int _size() {
		return buffer.size();
	}
	@Override
	public boolean _isEmpty() {
		return buffer.isEmpty();
	}
	@Override
	public boolean _containsKey(String key) {
		return buffer.containsKey(key);
	}
	@Override
	public boolean _containsValue(ConcurrentHashMap<String, DictRecord> value) {
		return buffer.containsValue(value);
	}
	@SuppressWarnings("unchecked")
	@Override
	public ConcurrentHashMap<String, DictRecord> _get(String key) {
		return (ConcurrentHashMap<String, DictRecord>) buffer.get(key);
	}
	@SuppressWarnings("unchecked")
	@Override
	public ConcurrentHashMap<String, DictRecord> _put(String key, ConcurrentHashMap<String, DictRecord> value) {
		return (ConcurrentHashMap<String, DictRecord>) buffer.put(key, value);
	}
	@SuppressWarnings("unchecked")
	@Override
	public ConcurrentHashMap<String, DictRecord> _remove(String key) {
		return (ConcurrentHashMap<String, DictRecord>) buffer.remove(key);
	}
	@Override
	public void _putAll(Map<String, ConcurrentHashMap<String, DictRecord>> m) {
		buffer.putAll(m);
	}
	@Override
	public void _clear() {
		buffer.clear();
	}
	@SuppressWarnings("unchecked")
	@Override
	public Set<String> _keySet() {
		return buffer.keySet();
	}
	@SuppressWarnings("unchecked")
	@Override
	public Collection<ConcurrentHashMap<String, DictRecord>> _values() {
		return buffer.values();
	}
	@SuppressWarnings("unchecked")
	@Override
	public Set<Entry<String, ConcurrentHashMap<String, DictRecord>>> _entrySet() {
		return buffer.entrySet();
	}
}
